//
//  jingHuaViewController.m
//  YuErmuYing
//
//  Created by Tiancheng on 16/9/3.
//  Copyright © 2016年 Tiancheng. All rights reserved.
//

#import "jingHuaViewController.h"
#import "HttpRequest.h"
#import "Macros.h"
#import "TCLYUser.h"
#import "SVProgressHUD.h"

@interface jingHuaViewController ()
@property(nonatomic,copy)NSMutableArray*json_Array;

@end

@implementation jingHuaViewController
@synthesize json_Array;

- (void)viewDidLoad {
    [super viewDidLoad];
    json_Array=[NSMutableArray array];
    [self getDataFromNet];
    [SVProgressHUD showWithStatus:@"加载中请稍后..."];
}
//从服务器获取数据
-(void)getDataFromNet
{
    NSMutableDictionary *parameters=[NSMutableDictionary dictionary];
    parameters[@"uid"]=userID;
    NSString*urlString=[NSString stringWithFormat:@"http://112.74.114.1/Parenting/index.php/api/note/hotnote"];
    HttpRequest *httpRequest=[HttpRequest sharedInstance];
    [httpRequest postWithURLString:urlString parameters:parameters success:^(id responseObject)
     {
         id json = [NSJSONSerialization JSONObjectWithData:responseObject options:0 error:nil];
         //获取数组
         json_Array=[json objectForKey:@"data"];
         if (json_Array.count>0)
         {
//             [self changeArray:json_Array];
//             [self createTableViewFromVC:@"3"];
             [self dismiss];
         }
     } failure:^(NSError *error) {
         NSLog(@"error=%@",error);
     }];
    
}
- (void)dismiss
{
    [SVProgressHUD dismiss];
    [self changeArray:json_Array];
    [self createTableViewFromVC:@"3"];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
